Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Printing Extensions and Drivers /
Chapter 3 - Printer Drivers / The QuickDraw GX ImageWriter II Printer Driver Messages


Terminating the Print Job

At the end of printing, your printer driver needs to clean up any storage that it has allocated. You can override the GXShutDown message to handle this task. The ImageWriter II printer driver overrides the GXShutDown message with the SD_Shutdown function, which is shown in Listing 3-18. The GXShutDown message
is described on page 4-44 in the chapter "Printing Messages."

Listing 3-18 Terminating the print job

OSErr SD_ShutDown(void) 
/*
   GXShutDown is called when the printing job is done. A good
   thing to do is to get rid of any additional storage.
*/
{
   /* clean up the globals */
   SpecGlobalsHdl hGlobals = GetMessageHandlerInstanceContext();

   /* get rid of the draft table if you allocated it */
   DisposHandle((**hGlobals).draftTable);
   
   /* get get rid of allocated storage */
   DisposHandle((Handle) hGlobals);
   
   /* clear out the globals - to avoid double disposes */
   SetMessageHandlerInstanceContext(nil);

   return(noErr);
}
The SD_ShutDown function essentially reverses what the SD_Initialize function
did at the start of printing, as shown in the section "Initializing the ImageWriter II Environment" beginning on page 3-24.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help